package com.micangcaihang.micang.mvp.task.ui;

import android.os.Bundle;

import com.micangcaihang.common.base.activity.BaseListActivity;
import com.micangcaihang.common.widget.titlebar.TitleBar;
import com.micangcaihang.micang.R;
import com.micangcaihang.micang.adapter.BusinessRemarkAfapter;
import com.micangcaihang.micang.databinding.ActivityBusinessRemarkBinding;
import com.micangcaihang.micang.entity.BusinessRemarkEntity;
import com.micangcaihang.micang.mvp.task.contract.BusinessRemarkContract;
import com.micangcaihang.micang.mvp.task.presenter.BusinessRemarkPresenter;

import java.util.ArrayList;
import java.util.List;

/**
 * <pre>
 *     author : Fandy
 *     e-mail : fandayongfly@gmail.com
 *     time   : 2017/07/25
 *     update : 2017/07/25
 *     desc   : 业务备注
 *     version: 1.0
 * </pre>
 */

public class BusinessRemarkActivity extends BaseListActivity<BusinessRemarkPresenter,
        BusinessRemarkAfapter, ActivityBusinessRemarkBinding> implements BusinessRemarkContract.View {


    private String id;

    @Override
    public void initPresenter() {
        super.initPresenter();
        mPresenter.setId(id);
    }

    /**
     * recycleView的设置
     */
    @Override
    protected void initAdapter() {
        mAdapter = new BusinessRemarkAfapter(R.layout.item_business_remark, new ArrayList<>());
    }

    /**
     * 初始化各种状态处理
     * 在这个方法里处理的是recyclerview的所有的初始化，
     * 包括对他的展示形式，是list或grid或瀑布流
     */
    @Override
    protected void initRecyclerViewSetting() {

    }

    /**
     * 获取资源文件布局
     *
     * @return 资源布局文件layout
     */
    @Override
    protected int getLayoutId() {
        return R.layout.activity_business_remark;
    }

    /**
     * 获取传递的bundle数据
     *
     * @param extras
     */
    @Override
    protected void getBundleExtras(Bundle extras) {
        id = extras.getString("id");
    }

    @Override
    protected void initData() {
        super.initData();
    }

    /**
     * 初始化按钮监听
     */
    @Override
    protected void initListener() {
        mViewBinding.titleBar.setDelegate(new TitleBar.Delegate() {
            @Override
            public void onClickLeftCtv() {
                finish();
            }

            @Override
            public void onClickTitleCtv() {

            }

            @Override
            public void onClickRightCtv() {

            }

            @Override
            public void onClickRightSecondaryCtv() {

            }
        });
    }

    /**
     * 返回业务备注信息
     *
     * @param list
     */
    @Override
    public void returnBusinessRemarkData(List<BusinessRemarkEntity> list) {
        mAdapter.setNewData(list);
        mViewBinding.progressLlyLayout.showContent();
    }
}
